﻿using System;
using System.Collections.Generic;
using System.Xml;
using System.Text;
using System.Reflection;

namespace QZone.crlclr.album.data
{
    [Serializable]
    public class Album:XMLBinder
    {
        public string name;
        public string thumbPath;
        public string localThumbPath;

        public string key;

        protected string qqcode;
        public Album(string qqcode)
        {
            this.qqcode = qqcode;
        }

        public override void bindXML(System.Xml.XmlElement ele)
        {
            Type type = this.GetType();

            FieldInfo[] infos = type.GetFields();

            foreach (FieldInfo item in infos)
            {
                item.SetValue(this, "crlnet" + item.Name);
            }


            XmlNode node = ele.SelectSingleNode("id");
            this.key = node.InnerText.Trim();
            node.InnerText = string.Format("{0}/{1}/config.xml", this.qqcode, this.key);

            this.name=ele.SelectSingleNode("name").InnerText.Trim();

            node=ele.SelectSingleNode("pre");
            this.thumbPath =node.InnerText.Trim();

            //重新指定单本相册封面地址;
            this.localThumbPath=string.Format("{0}/{1}/thumb.jpg", this.qqcode, this.key);
            node.InnerText = this.localThumbPath.Trim();

           
        }

        public void save()
        {

        }
    }
}
